﻿using AutoMapper;
using B.S.BaseData.Domain.Entities.Meeting;
using B.S.BaseData.ErrorCode;
using B.S.BaseData.ErrorCode.ErrorCodes;
using B.S.DataBase.EFCoreServiers.Dtos.MeetingApprovals;
using B.S.DataBase.EFCoreServiers.IServices.Meetings;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BaseData.ReadAPI.Controllers
{
    /// <summary>
    /// 审批管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    [ApiExplorerSettings(GroupName = "MeetingApproval")]
    public class MeetingApprovalController : ControllerBase
    {
        private readonly IMeetingApprovalServices services;
        private readonly ILogger<MeetingApprovalController> _logger;

        /// <summary>
        /// 构造函数
        /// </summary>
        public MeetingApprovalController(
            IMeetingApprovalServices services,
            ILogger<MeetingApprovalController> logger)
        {
            this.services = services;
            _logger = logger;
        }
        /// <summary>
        /// 审批列表
        /// </summary>
        /// <param name="queryDto"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<GetMeetingApprovalResponseDto>>> GetMeetingApprovalListAsync([FromQuery]GetMeetingApprovalDto queryDto)
        {
            try
            {
                var res = await services.GetMeetingApprovalListAsync(queryDto);
                return res;

            }
            catch (Exception)
            {
                return ApiResult<ApiPaging<GetMeetingApprovalResponseDto>>.Fail("审批列表出错", StatusCodeEnum.Exception);
            }
        }





    }
}
